package com.example.ecity.socialshare;    


import com.baidu.sharesdk.BaiduShareException;
import com.baidu.sharesdk.BaiduSocialShare;
import com.baidu.sharesdk.ShareContent;
import com.baidu.sharesdk.ShareListener;
import com.baidu.sharesdk.Utility;
import com.baidu.sharesdk.ui.BaiduSocialShareUserInterface;
import com.example.ecity.CameraLens;


import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.app.Activity;
import android.content.Context;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.view.View.OnClickListener;
import android.widget.Button;

public class SocialShare{
	private final String TAG = "SocialShare";
	private BaiduSocialShare socialShare;
	private BaiduSocialShareUserInterface socialShareUi;
	public final static String mAPP_KEY = "dHwDe5TTTtFEv4MOgoeTGLvX";
	private final static String wxAppId = "wxfd1e446ae353028b";
	private CameraLens mMain;
	private ShareContent pageContent;
	
	public SocialShare(Context context,CameraLens mMain){
		super();
		this.mMain = mMain;
		socialShare = BaiduSocialShare.getInstance(context,mAPP_KEY);
		socialShare.supportWeixin(wxAppId);
		socialShareUi = socialShare.getSocialShareUserInterfaceInstance();
	}
	
	public void setShareContent(String content,String url){
		pageContent = new ShareContent();
		pageContent.setContent(content);
		pageContent.setTitle("");
		pageContent.setUrl(url);
		pageContent.setImageUrl(url);
	}
	 
	
	public void Share(){
		socialShareUi.showShareMenu(mMain, pageContent,Utility.SHARE_THEME_STYLE, 
			new ShareListener() {     
				@Override     
				public void onAuthComplete(Bundle values) {
					Log.e(TAG,"onAuthComplete");
				}  
				@Override     
				public void onApiComplete(String responses) {
					Log.e(TAG,"onApiComplete");
				}  
				@Override     
				public void onError(BaiduShareException e) {
					Log.e(TAG,"onError");
				}     
			}); 
	}
}
